package com.probox.common.entity.vo.proboxService;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.probox.common.core.enums.StoreServiceType;
import com.probox.common.core.enums.SubscribeStatusEnum;
import com.probox.common.core.utils.DateUtils;
import lombok.Data;

import java.text.ParseException;
import java.util.Date;
import java.util.List;

@Data
public class SubscribeItem implements java.io.Serializable{
    private Long subscribeId;
    private String serviceType;
    private String startDate;
    private String endDate;
    //项目数量
    private Long serviceAmount;
    //持续时间
    private Long durationTime;
    private String customerMsg;
    private String customerSex;
    //客户姓名
    private Long customerId;
    private String customerName;
    private String mobile;
    private String serviceStatus;
    private String storeName;
    private String storePhone;
    private String dataStatus;
    //技师ID
    private Long techId;
    //美容师名称
    private String techName;
    //门店ID
    private Long storeId;

    //评价状态
    private String appraiseStatus;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date appraiseTime;
    private String appraiseContent;
    private String appraiseImages;
    private Long skillStar;
    private Long attitudeStar;
    private Long serveStar;



    /**
     * 是否显示取消按钮
     * @return
     */
    public boolean isShowCancelBtn(){
        /*
        if (serviceStatus.equals(SubscribeStatusEnum.ToBeServed.getKey())){
            if (subscribeRule != null && subscribeRule.getCancelHour() != null){
                try {
                    Long start = DateUtils.parseDate(startDate,"yyyy-MM-dd HH:mm").getTime();
                    if (subscribeRule.getCancelHour()*60*60*1000+System.currentTimeMillis()>start){
                        return false;
                    }
                } catch (ParseException e) {
                    e.printStackTrace();
                }
            }
            return true;
        }*/
        return false;

    }


    public String getDataStatusFmt(){
        if (dataStatus.equals("1")){
            return "有效";
        }else if (dataStatus.equals("2")){
            return "待确认";
        }
        return "无效";
    }

    public String getServiceStatusFmt(){
        if (serviceStatus.equals(SubscribeStatusEnum.EndService.getKey()) || serviceStatus.equals(SubscribeStatusEnum.ServiceRecord.getKey())){
            return "完成服务";
        }
        return SubscribeStatusEnum.getNameByKey(serviceStatus);
    }

    public String getServiceTypeFmt(){
        return StoreServiceType.getNameByKey(serviceType);
    }


}
